package com.sicnu.cheer.im.activity;

import android.view.View;
import android.widget.TextView;

import com.sicnu.cheer.generalmodule.activity.BaseActivity;
import com.sicnu.cheer.generalmodule.bean.NoticeBean;
import com.sicnu.cheer.im.R;

/**
 * Created by cheer on 2017/2/13.
 * 通知详情页
 */
public class NoticeDetailActivity extends BaseActivity {

    private TextView usernameTime;
    private TextView titleTV;
    private TextView contentTV;
    private NoticeBean notice;

    @Override
    public int getContentViewId() {
        return R.layout.activity_notice_detail;
    }

    @Override
    protected void initView() {
        super.initView();
        ((TextView) findViewById(R.id.title)).setText("通知详情");
        findViewById(R.id.back).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        titleTV = ((TextView) findViewById(R.id.title_tv));
        usernameTime = ((TextView) findViewById(R.id.username_time_tv));
        contentTV = ((TextView) findViewById(R.id.content_tv));
    }

    @Override
    protected void initData() {
        super.initData();
        notice = (NoticeBean) getIntent().getSerializableExtra("notice");
    }

    @Override
    protected void afterViews() {
        super.afterViews();
        if (notice!=null){
            try {
                titleTV.setText(notice.getTitle());
                String username=notice.getLeague().getName();
                String time=notice.getUpdatedAt();
                usernameTime.setText(username+" "+time);
                contentTV.setText(notice.getContent());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
